import Vue from "vue";
import App from "./App.vue";

import router from "./router";
import store from "./store";  //store就是vuex

//全局组件
import TypeNav from '@/components/typenav/'  //竖向菜单栏
import Carousel from '@/components/carousel'  //图片轮播组件
import Pagination from '@/components/pagination'  //分页器

import { Button, MessageBox } from 'element-ui'; //引入ElementUI组件

import * as API from '@/api' //将项目全部请求函数引入进来[分别暴露],组成一个对象，对象名称为API
import '@/mock/mockService'  //引入mock处理
import 'swiper/css/swiper.css' ////不需要暴露就不用使用from, 引用swiper 轮播的样式
import '@/plugins/vueLazyload'  //懒加载图片
//import '@/plugins/validate'  //表单校验



Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.component(Pagination.name, Pagination)

//另一种注册组件
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

Vue.config.productionTip = false  //关闭提示






new Vue({
  render: (h) => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this;  //事件总线
    Vue.prototype.$API = API;   //将API添加到原型中， 使用时就可以 this.$API. 
  },
  router,
  store,
}).$mount("#app");
